#include <vector>
#include <fstream>
#include <iostream>

using namespace std;

// 矩形的一个点
struct Point {
  int x;
  int y;
};

struct Rect {
  Point bl; // bottom left
  Point tr; // top right

  // 方法
  // bl 和 tr 这两个点组成的矩形的面积
  int area() {
    return (tr.x - bl.x) * (tr.y - bl.y);
  }

  // 用于判断 pt 这个点是否包含在由 bl 和 tr 组成的矩形里
  bool covered(Point pt) {
    return 
      pt.x >= bl.x && pt.x <= tr.x &&
      pt.y >= bl.y && pt.y <= tr.y;
  }
};



int main(int argc, char const *argv[])
{
  /* code */
  ifstream ifs("BlockedBillboard.in");

  int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
  int x3 = 0, y3 = 0, x4 = 0, y4 = 0;

  ifs >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x4 >> y4;

  // 除草机广告牌的四个角
  Point bl {x1, y1}; // 左下
  Point tl {x1, y2}; // 左上
  Point br {x2, y1}; // 右下
  Point tr {x2, y2}; // 右上

  Rect mowerRect {
    {x1, y1},
    {x2, y2}
  };

  Rect fodderRect {
    {x3, y3},
    {x4, y4}
  };

  int count = 0; // 饲料广告牌覆盖除草机广告牌的角数

  if (fodderRect.covered(bl)) { ++count; }
  if (fodderRect.covered(tl)) { ++count; }
  if (fodderRect.covered(br)) { ++count; }
  if (fodderRect.covered(tr)) { ++count; }

  int area = 0;

  if (count == 1) {
    area = mowerRect.area();
  }
  else if (count == 4) {
    area = 0;
  }
  else if (count == 2) {
    Point coveredBl { max(x1, x3), max(y1, y3) };
    Point coveredTr { min(x2, x4), min(y2, y4) };

    Rect rect {coveredBl, coveredTr};

    area = mowerRect.area() - rect.area();
  }

  // 尽可能把变量定义在要使用它之前
  ofstream ofs("BlockedBillboard.out");
  ofs << area;

  return 0;
}
